package com.gemme.gemme.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.gemme.gemme.R;
import com.gemme.gemme.wode.DingdanListBean;

public class SgDDView extends RelativeLayout {
    private Context context;
    public SgDDView(Context context) {
        this(context,null);
    }

    public SgDDView(Context context, AttributeSet attrs) {
        this(context, attrs,0);
    }

    public SgDDView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        this.context = context;
        initView();
    }
    ImageView iv_head;
    TextView tv_name;
    TextView tv_guige;
    TextView tv_discount_price;
    TextView tv_orginnal_price;
    TextView tv_num;
    private void initView() {
        LayoutInflater.from(context).inflate(R.layout.sg_dd_view,this);
        iv_head = findViewById(R.id.iv_head);
        tv_name = findViewById(R.id.tv_name);
        tv_guige = findViewById(R.id.tv_guige);
        tv_discount_price = findViewById(R.id.tv_discount_price);
        tv_orginnal_price = findViewById(R.id.tv_orginnal_price);
        tv_num = findViewById(R.id.tv_num);
    }

    public void setdata(DingdanListBean.DataBean bean) {
        try {
            tv_name.setText(bean.getProductName()+"");
            tv_guige.setText(bean.getOther1()+"");
            tv_discount_price.setText(bean.getPaymentMoney() +"");
            tv_orginnal_price.setText(bean.getProductPrice()+"");
            tv_num.setText(bean.getProductCnt()+"");
            Glide.with(context).load(bean.getProductImage()).into(iv_head);
        }catch (Exception e){

        }
    }
}
